#ifndef __LAMP_CTRL_H__
#define __LAMP_CTRL_H__

#include <stdio.h>

#define LEDC_MODE   LEDC_LOW_SPEED_MODE
#ifdef ESP32C5_INUSE
#define LED_GPIO_Y    GPIO_NUM_3
#define LED_GPIO_W    GPIO_NUM_6
#else
#define LED_GPIO_Y    GPIO_NUM_3
#define LED_GPIO_W    GPIO_NUM_4
#endif
#define LED_CHANNEL_Y LEDC_CHANNEL_1 
#define LED_CHANNEL_W LEDC_CHANNEL_2
#define LEDC_TIMER_BIT_NUM LEDC_TIMER_12_BIT 
#define LEDC_BASE_FREQ 16000
#define LEDC_DUTY   4095

typedef struct {
    uint8_t onoff_status;
    uint8_t control_mode;
    uint8_t brightness_val;
    uint8_t color_temp;
    uint16_t delay_time;
    uint8_t scene_mode;
    uint8_t tomato_mode;
    bool first_turnon;
}lamp_t;

extern lamp_t lamp;
extern lamp_t lamp_ex;
extern void lamp_manage_init(void);
extern void lamp_set_fade(uint8_t brightness, uint8_t colortemp, uint16_t delay_ms);
extern void lamp_set_brightness(uint8_t brightness, uint8_t colortemp);
extern void lamp_updata(uint8_t onoff, uint8_t brightness, uint8_t colortemp);

#endif
